---
image: /generated/articles-docs-cloudrun-testpermissions.png
id: testpermissions
title: testPermissions()
slug: /cloudrun/testpermissions
crumb: 'Cloud Run API'
---

<ExperimentalBadge>
  <p>
    Cloud Run is in <a href="/docs/cloudrun/status">Alpha status and not actively being developed.</a>
  </p>
</ExperimentalBadge>

Makes a call to the [Test Iam Permissions](https://cloud.google.com/resource-manager/reference/rest/v3/projects/testIamPermissions) method of the Resource Manager API in GCP, which returns the list of permissions the Service Account has on the GCP Project. This is then validated against the list of permissions required for the version of Remotion.

The CLI equivalent is `npx remotion cloudrun permissions`.

The function does not reject with an error if a permission is missing, rather the missing permission is indicated in the return value.

## Example

```ts twoslash
import {testPermissions} from '@remotion/cloudrun';

const {results} = await testPermissions();

for (const result of results) {
  console.log(result.decision); // "allowed"
  console.log(result.permissionName); // "iam.serviceAccounts.actAs"
}
```

## Arguments

An object with the following property:

### `onTest?`

_optional_

A callback function that gets called every time a new test has been executed. This allows you to react to new test results coming in much faster than waiting for the return value of the function. Example:

```ts twoslash
import {testPermissions} from '@remotion/cloudrun';

const {results} = await testPermissions({
  onTest: (result) => {
    console.log(result.decision); // "allowed"
    console.log(result.permissionName); // "iam.serviceAccounts.actAs"
  },
});
```

## Return value

**An array of objects** containing simulation results of each necessary permission. The objects contain the following keys:

### `decision`

Either `true` or `false`.

### `permissionName`

The identifier of the required permission. See the [Permissions page](/docs/cloudrun/permissions) to see a list of required permissions.

## See also

- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/cloudrun/src/api/iam-validation/testPermissions.ts)
- [Permissions](/docs/cloudrun/permissions)
